package com.multi.thread.chapter01;

public class UnsafeThread extends Thread {
	
	private int count = 5;

	@Override
	synchronized public void run() {
		System.out.println("i = " + (count--) + ", threadName = " + Thread.currentThread().getName());
	}
	
	public static void main(String[] args) {
		UnsafeThread unsafeThread = new UnsafeThread();
		Thread a = new Thread(unsafeThread);
		Thread b = new Thread(unsafeThread);
		Thread c = new Thread(unsafeThread);
		Thread d = new Thread(unsafeThread);
		Thread e = new Thread(unsafeThread);
		a.start();
		b.start();
		c.start();
		d.start();
		e.start();
		System.out.println("threadName = " + Thread.currentThread().getName());
	}

}
